home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / s / supremov3.00a1.dms / supremov3.00a1.adf / S / Make_DB_a_pc.sm < prev    next >
Text File  |  1992-04-01  |  2KB  |  54 lines

  1. /*******************************************************************************
  2.  *
  3.  *   Make_DB.sm                      Copyright (c) 7.04.1995, K. Wojcieszek
  4.  *
  5.  *   Program uruchomiony pod SuperMemo v3.0 (lub nowszym) dopisuje
  6.  *   teksty pytaï i odpowiedzi do aktualnie otwartej bazy w SuperMemo
  7.  *   (najczëôciej jest to baza pusta) z edytora AmiTekst PRO (AmiTekst_port),
  8.  *   lub innego wyposaûonego w port Arexx-a.
  9.  *
  10.  *   Wersja 2.00
  11.  *
  12.  *******************************************************************************/
  13.  
  14. OPTIONS RESULTS
  15. ADDRESS 'rexx_sm'
  16.  
  17. CR = '0A'X                    /* CR - znak koïca linii */
  18.  
  19. sm_to_add                    /* Przejdú w tryb dodawania */
  20.  
  21. ADDRESS 'AmiTekst_port' STATUS NumLines
  22. NumLines = RESULT                /* NumLines - liczba linii tekstu */
  23.  
  24. l = 1;  question = '';  answer = '';  rep = ''
  25. DO while (l <= NumLines)
  26.     ADDRESS 'AmiTekst_port' JumpToLine l        /* Ustaw kursor w linii: l */
  27.     ADDRESS 'AmiTekst_port' BegOfLine            /* Ustaw kursor na poczâtku linii */
  28.     ADDRESS 'AmiTekst_port' STATUS LineBuffer
  29.     line = RESULT                                /* Pobierz zawartoôê aktualnej linii */
  30.     l = l + 1
  31.     if substr(line, 1, 2) = 'Q:' then            /* Formatowanie pytania */
  32.         question = question || delstr(line, 1, 3)
  33.     else
  34.     if substr(line, 1, 2) = 'A:' then            /* Formatowanie odpowiedzi */
  35.         answer = answer || delstr(line, 1, 3)
  36.     else
  37.     if substr(line, 1, 2) = 'I:' then            /* Formatowanie odpowiedzi */
  38.         rep = delstr(line, 1, 3)
  39.     else
  40.     if line = CR then                            /* Jednostka kompletna */
  41.     DO
  42.         sm_put_q question
  43.         sm_PC_AMI answer
  44.         answer = RESULT                                /* Pobierz zawartoôê aktualnej linii */
  45.         sm_put_a answer
  46.         if rep ~= '' then  sm_put_rep rep
  47.         sm_write                                /* Zapis do bazy */
  48.         if RESULT = 'RESULT' then LEAVE
  49.         question = '';  answer = '';  rep = ''
  50.     END
  51. END
  52.  
  53. sm_to_end                                        /* Zamknij okno dodawania */
  54.